package org.blog.entity;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.util.Date;

@Data
@ApiModel(value = "日志表")
@TableName(value = "blog_logs")
public class BlogLogs {
    @ApiModelProperty(value = "日志表主键")
    @TableId(value = "id")
    private String id;

    @ApiModelProperty(value = "日志级别")
    @TableField(value = "log_level")
    private Integer logLevel;

    @ApiModelProperty(value = "日志信息")
    @TableField(value = "log_message")
    private String logMessage;

    @ApiModelProperty(value = "操作类型，登录，查询数据，修改，删除")
    @TableField(value = "operation_type")
    private Integer operationType;

    @ApiModelProperty(value = "日志来源，API，后台任务等")
    @TableField(value = "log_source")
    private String logSource;

    @ApiModelProperty(value = "服务名称")
    @TableField(value = "service_name")
    private String serviceName;

    @ApiModelProperty(value = "产生日志的用户ip地址")
    @TableField(value = "ip")
    private String ip;

    @ApiModelProperty(value = "接口请求uri")
    @TableField(value = "request_uri")
    private String requestUri;

    @ApiModelProperty(value = "异常，记录堆栈信息 ")
    @TableField(value = "exception_info")
    private String exceptionInfo;

    @ApiModelProperty(value = "方法执行时间，记录毫秒数")
    @TableField(value = "duration")
    private Long duration;

    @ApiModelProperty(value = "日志时间戳")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @TableField(value = "log_time")
    private Date logTime;
}

